
'use strict';
const app = require('tcb-admin-node');
const tcb_config = {env: 'meatom04-01-2gue0fnr49a26808'};
app.init(tcb_config).auth();
const db = app.database();
let event_param

function delVerCon(param) {
    event_param = param
    return db.collection("VersionCon").where({
        version : event_param.id, 
        platform : event_param.platform,
    }).remove().then(res=>{
        return delVer()
    }).catch(error => {
        return error
    })
}
function delVer(){
  return  db.collection("Version").where({
      id : event_param.id,
      platform : event_param.platform
    }).remove().then(res=>{
    return res
  }).catch(error => {
      return error
  })
}
exports.main = async (event, context, callback) => {
    return await delVerCon(event)
};
